package com.yanqu.backendweb.controller;

import com.alibaba.fastjson.JSON;
import com.yanqu.backendweb.service.AbsLogService;
import com.yanqu.backendweb.utils.Response;
import com.yanqu.backendweb.utils.SpringContext;
import com.yanqu.backendweb.utils.Utils;
import com.yanqu.backendweb.vo.LogVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.SortedMap;

/**
 * @author duli
 * @version 1.0
 * @date 2020/11/4 9:46
 * @Description 玩家管理-日志查询
 */
@RestController
@RequestMapping("/log")
public class LogController {
    /*
     * 获取日志信息
     * */
    @RequestMapping("/get")
    @ResponseBody
    public Response get(String requestId, String sign, @RequestBody @Valid LogVo vo){
      /*  SortedMap<String, Object> paramMap = JSON.parseObject(JSON.toJSONString(vo), SortedMap.class);
        paramMap.put("requestId",requestId);
        boolean flag= Utils.checkSign(paramMap,sign);
        if(flag){
            AbsLogService service = SpringContext.getBean(vo.getType().getService());
            return service.getLog(vo);
        }else{
            return Response.singError();
        }*/
        AbsLogService service = SpringContext.getBean(vo.getLog_type().getService());
        return service.getLog(vo);
    }
}
